home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Sherlock 2.0 / SDEL / SDELsrc / sdel_init.c < prev    next >
Text File  |  1996-04-06  |  3KB  |  121 lines

  1. /*
  2.     SDEL: initialization code
  3.     
  4.     source: sdel_init.c
  5.     started: April 2, 1996.
  6.     version: April 6, 1996.
  7. */
  8.  
  9. // include these *before* Sherlock is included.
  10.  
  11. #include <Dialogs.h>
  12. #include <Fonts.h>
  13. #include <Menus.h>
  14. #include <Quickdraw.h>
  15. #include <OSEvents.h>
  16. #include <Windows.h>
  17. #include <LIBdialog.h>
  18. #include <mac_gui.h>
  19.  
  20. #include "sdel.h"
  21. #include "sdel_arg.h"
  22. #include "sdel_init.h"
  23.  
  24. #include <LIBcmnd.h>
  25. #include <LIBend.h>
  26. #include <LIBenv.h>
  27. #include <LIBlog.h>
  28. #include <LIBobj.h>
  29.  
  30. // Private prototypes
  31.  
  32. static void    event_call_back    (void);
  33. static void help            (void);
  34.  
  35. // Initialize everything
  36.  
  37. void
  38. init_all(void)
  39. {
  40.     FTAG("init_all");
  41.     
  42.     // Initialize the ToolBox
  43.     
  44.         MaxApplZone();    
  45.         MoreMasters();                   
  46.         MoreMasters();                   
  47.         MoreMasters();                   
  48.         MoreMasters();           
  49.         MoreMasters();
  50.         
  51.         InitGraf( (Ptr) &(qd.thePort));
  52.         InitFonts();
  53.         InitWindows();
  54.         InitMenus();
  55.         TEInit();
  56.         InitDialogs(0L);
  57.         FlushEvents(everyEvent,0);
  58.         InitCursor();
  59.  
  60.     // Initialize the Sherlock window.
  61.  
  62.         w_mac_init(
  63.             FALSE,                    /* Initialize the Macintosh ToolBox. */
  64.             TRUE,                    /* TRUE: output to Sherlock window. */
  65.             "SDEL LOG",                /* Name of Sherlock window (if used). */
  66.             TRUE,                    /* TRUE: open Sherlock window. */
  67.             TRUE,                    /* TRUE: Insert standard menus. */
  68.             TRUE,                    /* TRUE: Insert Sherlock menu. */
  69.             TRUE,                    /* TRUE: Insert first item in apple menu. */
  70.             (pstring) "\pAbout SDEL...",    /* Title of first item in apple menu. */
  71.             &about_dialog,            /* CallBack routine for first apple item. */
  72.             TRUE,                    /* TRUE: Insert menus immediately. */
  73.             &event_call_back,        /* Event callback routine. */
  74.             NULL,                    /* First user callback routine. */
  75.             (pstring) "\p",            /* Name of first user menu item. */
  76.             NULL,                    /* Second user callback routine. */
  77.             (pstring) "\p",            /* Name of second user menu item. */
  78.             NULL,                    /* Third user callback routine. */
  79.             (pstring) "\p"            /* Name of third user menu item. */
  80.         );
  81.  
  82.     // Initialize Sherlock.
  83.     
  84.         SL_INIT();
  85.  
  86.     // Process all arguments.
  87.     {
  88.         int argc = 0;
  89.         char ** argv = NULL;
  90.  
  91.         init_args(&argc, &argv, lib_arg_file_name);
  92.         SL_PARSE(argc, argv, "++", "--");
  93.         
  94.         /* Sherlock traces now in effect. */
  95.         arg_do_argv(argc, argv);
  96.     }
  97.  
  98.     STATB(ftag);
  99.  
  100.     /* Watch location 0.  This test catches *p = x where p is NULL. */
  101.     SL_WATCH(0, 4, "loc 0");
  102.  
  103.     /* Sign on _after_ opening the log file. */
  104.     ecnl(); es(lib_version); ecnl();
  105.     
  106.  
  107.     STATX(ftag);
  108. }
  109.  
  110. // "Call-back" routine for event processing when Sherlock outputs a line.
  111.  
  112. static void
  113. event_call_back(void)
  114. {
  115.     SL_DISABLE();
  116.  
  117.     if (w_applEvent(0) == FALSE) {
  118.         main_quit();
  119.     }
  120. }
  121.